package nameless.aistudy.domain.model.subjects.english.vocabulary.book;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import nameless.aistudy.domain.model.subjects.english.vocabulary.dto.WordDetailDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;


@Mapper
@Repository
public interface VocabularyBookRepo extends BaseMapper<VocabularyBook>{

    //查询对应词汇本下的所有单词
    List<WordDetailDTO> getWordsByBookId(@Param("bookId") Integer bookId);

    //查询词汇本名称,废弃
    String getBookName(@Param("bookId") Integer bookId);

    List<VocabularyBook> getAllVocabularyBooks();

    @Select("SELECT * FROM subject_english_vocabulary_book WHERE name = #{bookName}")
    VocabularyBook selectByBookName(@Param("bookName") String bookName);
}
